package com.lagou.reducer;

import com.lagou.bean.ScoreBeanSort;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;


public class SortReducer extends Reducer<LongWritable,LongWritable,LongWritable,LongWritable> {
    private static LongWritable linesum = new LongWritable(1);

    @Override
    protected void reduce(LongWritable key, Iterable<LongWritable> values, Context context)
            throws IOException, InterruptedException {
        for (LongWritable v : values) {
            context.write(linesum, key);
            linesum = new LongWritable(linesum.get() + 1);
        }
    }
}


